From 789515e14798cd56eab959ed9f94e384a7e4cbb6 Mon Sep 17 00:00:00 2001
From: Hal Emmerich <hal@halemmerich.com>
Date: Sun, 8 Dec 2019 22:18:46 -0600
Subject: [PATCH] Blank screen before displaying device information and wait
 for the user to press a key to return to the developer mode screen

---
 firmware/lib/vboot_display.c | 18 ++++++++----------
 firmware/lib/vboot_ui.c      | 11 +++++++++++
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c
index ea36c1f1..d3d98e25 100644
--- a/firmware/lib/vboot_display.c
+++ b/firmware/lib/vboot_display.c
@@ -271,7 +271,7 @@ const char *RecoveryReasonString(uint8_t code)
 	return "We have no idea what this means";
 }
 
-#define DEBUG_INFO_SIZE 512
+#define DEBUG_INFO_SIZE 768
 
 VbError_t VbDisplayDebugInfo(struct vb2_context *ctx)
 {
@@ -285,14 +285,8 @@ VbError_t VbDisplayDebugInfo(struct vb2_context *ctx)
 	VbError_t ret;
 	uint32_t i;
 
-	/* Redisplay current screen to overwrite any previous debug output.
-	 * Need to use VbDisplayMenu instead of VbDisplayScreen
-	 * in order to ensure that the selected menu item is
-	 * highlighted.  On a non-detachable screen, this will be a
-	 * no-op.
-	 */
-	VbDisplayMenu(ctx, disp_current_screen, 1,
-		      disp_current_index, disp_disabled_idx_mask);
+	/* Blank screen*/
+	VbDisplayScreen(ctx, VB_SCREEN_BLANK, 1);
 
 	/* Add hardware ID */
 	VbGbbReadHWID(ctx, hwid, sizeof(hwid));
@@ -399,7 +393,11 @@ VbError_t VbDisplayDebugInfo(struct vb2_context *ctx)
 	}
 
 	/* Make sure we finish with a newline */
-	used += StrnAppend(buf + used, "\n", DEBUG_INFO_SIZE - used);
+	used += StrnAppend(buf + used, "\n\n", DEBUG_INFO_SIZE - used);
+
+	used += StrnAppend(buf + used, "Press any key to continue\n\n",
+			   DEBUG_INFO_SIZE - used);
+
 
 	/* TODO: add more interesting data:
 	 * - Information on current disks */
diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c
index cc8abba2..832b46f1 100644
--- a/firmware/lib/vboot_ui.c
+++ b/firmware/lib/vboot_ui.c
@@ -322,6 +322,17 @@ developer_mode_screen:
 								"hold developer mode screen\n"));
 			hold = 1;
 			break;
+		case 0x09:
+			/* Ctrl+I = device information */
+			VB2_DEBUG(("VbBootDeveloper() - "
+			"device info\n"));
+			hold = 1;
+			VbDisplayDebugInfo(ctx);
+
+			while (!VbExKeyboardRead()) ;
+
+			goto developer_mode_screen;
+			break;
 		case 0x0c:
 			VB2_DEBUG("VbBootDeveloper() - "
 				  "user pressed Ctrl+L; Try legacy boot\n");
-- 
2.20.1

